import request from "@/utils/request";
import type { ResponseData } from "@/api/user/type";
import type { TradeMarkResponseData } from "../trademark/type";
import type { SkuData } from "../spu/type";
import { epPropKey } from "element-plus/es/utils/index.mjs";
enum API {
  //获取已有SKU的数据
  SKUDATA_URL = "/admin/product/list/",
  //SKU商品的上架
  ONSALESKU_URL = "/admin/product/onSale/",
  //SKU商品的下架
  CANCELSALESKU_URL = "/admin/product/cancelSale/",
  //获取SKU商品的详细信息
  SKUINFO_URL = "/admin/product/getSkuInfo/",
  //删除某一个已有的SKU商品
  REMOVESKU_URL = "/admin/product/deleteSku/",
}
///获取已有SKU的数据
export const reqHasSkuData = (
  page: number | string,
  limit: number | string
) => {
  return request.get<any, ResponseData<TradeMarkResponseData<SkuData>>>(
    `${API.SKUDATA_URL}${page}/${limit}`
  );
};
//SKU商品的上架
export const reqOnSaleSku = (skuId: number | string) => {
  return request.get<any, any>(API.ONSALESKU_URL + `${skuId}`);
};
//SKU商品的下架
export const reqCancelSaleSku = (skuId: number | string) => {
  return request.get<any, any>(API.CANCELSALESKU_URL + `${skuId}`);
};
//获取SKU商品的详细信息
export const reqGetSkuInfo = (skuId: number | string) => {
  return request.get<any, ResponseData<SkuData>>(API.SKUINFO_URL + `${skuId}`);
};
//删除某一个已有的SKU商品
export const reqRemoveSku = (skuId: number | string) => {
  return request.delete<any, any>(API.REMOVESKU_URL + `${skuId}`);
};
